<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="root"></div>
    <script src="../js/vue.js"></script>
    <script>
        //创建x1组件
        const x1 = {
            template: `
            <div>
                <h3>这是x1组件</h3>
                </div>
            `
        }
        // 创建x组件
        const x = {
            template: `
            <div>
                <h2>这是x组件</h2>
                <x1></x1>
                </div>
            `,
            components: { x1 }
        }
        // 创建app组件
        const app = {
            template: `
            <div>
                <h1>app组件</h1>
                <x></x>
            </div>
            `,
            components: { x }
        }
        const vm = new Vue({
            el: '#root',
            template: `
            <app></app>
            `,
            // 注册组件
            components: {
                app
            }
        })
    </script>
</body>

</html>